package com.etalk.crm.client.interfaces;

import com.etalk.crm.client.fallbacks.BookCourseClientHystrix;
import com.etalk.crm.pojo.TeacherProperty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author Jordan
 * @date 2019/7/11 11:00
 * @description
 */

@FeignClient(name="${feign.client.bookcourse.name}",url = "${feign.client.bookcourse.url}",fallback= BookCourseClientHystrix.class)
public interface BookCourseClient {

    /**
     * 约课方法
     * @param orderId 订单id
     * @param classTimestamp 所约课程的时间戳
     * @param recorder 操作人
     * @param recordId 操作人id
     * @param classWay 上课方式
     * @param money 支付币数
     * @param cflag 是否常用老师
     * @param lxflag 可约非连续老师   1是，0否
     * @param teacherProperty 查询老师条件
     * @return String
     */
    @PostMapping(value = "/auto/course/booking/{orderId}/{classTimestamp}/{classWay}/{recorder}/{payMoney}/{cflag}/{lxflag}")
    String studentBookingCourse(@PathVariable(value = "orderId") String orderId, @PathVariable(value = "classTimestamp") long classTimestamp,
                                @PathVariable(value = "recorder", required = false) String recorder, @RequestParam(value = "recordId", required = false) Integer recordId,
                                @PathVariable(value = "classWay") Integer classWay,
                                @PathVariable(value = "payMoney", required = false) int money, @PathVariable(value = "cflag", required = false) Integer cflag,
                                @PathVariable(value = "lxflag", required = false) Integer lxflag, @RequestParam TeacherProperty teacherProperty,
                                @RequestParam(value = "tokenString") String tokenString);

    /**
     * 取消课程
     * @param lessonId 课程id，多个id以英文逗号分隔
     * @param recorder 操作人
     * @param recordId 操作人id
     * @param flag 课前60分钟内取消课0：检测  ，1不检测
     * @param cancelReasonId 取消课程原因
     * @return
     */
    @RequestMapping(value="/crm/course/cancel/{lessonId}/{recorder}/{flag}",method={RequestMethod.POST})
    String cancelClass(@PathVariable(value="lessonId") String lessonId, @PathVariable(value="recorder")String recorder,
                       @RequestParam("recordId") Integer recordId, @PathVariable(value="flag")Integer flag,@RequestParam("cancelReasonId")Integer cancelReasonId);
}
